//
// Created by wze-zero on 2024/7/22 022.
//
#include <iostream>
#include <vector>

using namespace std;

int main() {
    vector<int> v;
    int num;
    for (int i = 0; i < 5; ++i) {
        cin >> num;
        v.push_back(num);
    }
    for (vector<int>::iterator i = v.begin(); i != v.end(); ++i) {
        cout << *i << " ";
    }
    cout << endl;
    for (vector<int>::iterator i = v.end() - 1; i != v.begin() - 1; --i) {
        cout << *i << " ";
    }
    cout << endl;
    return 0;
}